package com.zxc.project.base;

import cn.hutool.core.bean.BeanUtil;

/**
* @author zxc_user
* @date 2021/3/3 21:14
* @version 1.0
* @description 基础控制器.不做请求转发!
**/
public abstract class BaseController {

    protected <T> BaseResponseEntity<T> success(T data) {
        return BaseResponseEntity.success(data);
    }

    protected <T extends BaseEntity> T getPojo(Class<T> clazz, BaseRequest<T> baseRequest) {
        return getPojo(clazz, baseRequest, false);
    }

    protected <T extends BaseEntity> T getPojo(Class<T> clazz, BaseRequest<T> baseRequest, boolean updateTime) {
        T toBean = BeanUtil.toBean(baseRequest, clazz);
        toBean.init(updateTime);
        return toBean;
    }
}
